<?php

namespace App\Http\Resources\Admin;

use App\Http\Resources\BaseResource;

class PermissionResource extends BaseResource
{
    /**
     * Transform the resource collection into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function toArray($request)
    {
        return [
            'id' => $this->id,
            'name' => $this->name,
            'code' => $this->code,
            'module' => $this->module,
            'type' => (string) $this->type,
            'type_text' => get_model_code('permission.type', $this->type),
            'created_at' => $this->created_at
        ];
    }
}
